const express = require('express')
const fs = require('fs')
const path = require('path')
const app = express()
app.listen(8080)

app.get('/', (req, res) => {
  // 数据库读出来
  let username = '变量'

  // 视图模板路径
  let filepath = path.join(__dirname, 'html', '1.html')

  let html = fs.readFileSync(filepath).toString()

  // 处理模板，把标识的字符给转为变量输出
  html = html.replace('#username#',username)

  res.end(html)
})